﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CardInChina.Bussiness.Frontend.Interface;

namespace CardInChina.Web.Mvc.Controllers
{
    public class HomeController : CICBasicController
    {
        //[OutputCache(Duration = int.MaxValue, VaryByParam = "none")]
        // 不能缓存，否则用户登录信息不能改变
        // TODO: 首页是必须要缓存的，用户信息将会改成Ajax方式后期加载
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult About()
        {
            return View();
        }

        public ActionResult _500()
        {
            throw new NotSupportedException("此页面不被支持");
        }

        public ActionResult _404()
        {
            return View();
        }

        public ActionResult Recommend(string cid)
        {
            if (cid != null)
            {
                UserService us = new UserService();
                if (us.ValidateRecommended(cid))
                    CurrentUser.Recommended = int.Parse(cid);
            }
            return Redirect("/");
        }
    }
}
